//
//  LYDSegmentController.h
//  ZeegingLottery
//
//  Created by 李曌 on 2018/10/18.
//  Copyright © 2018 蒂埃里. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LYDSegmentView.h"

NS_ASSUME_NONNULL_BEGIN
@interface LYDSegmentController : UIViewController

// initial
+ (__nullable instancetype)segmentControllerWithTitles:(NSArray <NSString *>*)titles;
- (__nullable instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titles;

@property (nonatomic, strong) NSArray <UIViewController *>*viewControllers;
@property (nonatomic, strong, readonly) UIViewController *currentViewController;
@property (nonatomic, strong, readonly) UIScrollView *containerView;
@property (nonatomic, strong, readonly) LYDSegmentView *segmentView;
@property (nonatomic, readonly) NSUInteger index;
@property (nonatomic, getter=isPagingEnabled) BOOL pagingEnabled;
@property (nonatomic, getter=isBounces) BOOL bounces;

/// index
- (void)selectedAtIndex:(void(^)(NSUInteger index, UIButton *button, UIViewController *viewController))indexBlock;
- (void)setSelectedAtIndex:(NSUInteger)index;

@end


@interface UIViewController (LYDSegment)

@property (nonatomic, strong, readonly) LYDSegmentController *segmentController;
- (void)addSegmentController:(LYDSegmentController *)segment;

@end


NS_ASSUME_NONNULL_END
